home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 2: CDPD 1 / Almathera Ten on Ten - Disc 2: CDPD 1.iso / protracker / ptfileformat.txt < prev    next >
Text File  |  1995-03-15  |  4KB  |  122 lines

  1. Have you ever wondered how a Protracker 1.1B module is built up?
  2.  
  3. Well, here's the...
  4.  
  5. Protracker 1.1B Song/Module Format:
  6. -----------------------------------
  7.  
  8. Offset  Bytes  Description
  9. ------  -----  -----------
  10.    0     20    Songname. Remember to put trailing null bytes at the end...
  11.  
  12. Information for sample 1-31:
  13.  
  14. Offset  Bytes  Description
  15. ------  -----  -----------
  16.   20     22    Samplename for sample 1. Pad with null bytes.
  17.   42      2    Samplelength for sample 1. Stored as number of words.
  18.                Multiply by two to get real sample length in bytes.
  19.   44      1    Lower four bits are the finetune value, stored as a signed
  20.                four bit number. The upper four bits are not used, and
  21.                should be set to zero.
  22.                Value:  Finetune:
  23.                  0        0
  24.                  1       +1
  25.                  2       +2
  26.                  3       +3
  27.                  4       +4
  28.                  5       +5
  29.                  6       +6
  30.                  7       +7
  31.                  8       -8
  32.                  9       -7
  33.                  A       -6
  34.                  B       -5
  35.                  C       -4
  36.                  D       -3
  37.                  E       -2
  38.                  F       -1
  39.  
  40.   45      1    Volume for sample 1. Range is $00-$40, or 0-64 decimal.
  41.   46      2    Repeat point for sample 1. Stored as number of words offset
  42.                from start of sample. Multiply by two to get offset in bytes.
  43.   48      2    Repeat Length for sample 1. Stored as number of words in
  44.                loop. Multiply by two to get replen in bytes.
  45.  
  46. Information for the next 30 samples starts here. It's just like the info for
  47. sample 1.
  48.  
  49. Offset  Bytes  Description
  50. ------  -----  -----------
  51.   50     30    Sample 2...
  52.   80     30    Sample 3...
  53.    .
  54.    .
  55.    .
  56.  890     30    Sample 30...
  57.  920     30    Sample 31...
  58.  
  59. Offset  Bytes  Description
  60. ------  -----  -----------
  61.  950      1    Songlength. Range is 1-128.
  62.  951      1    Well... this little byte here is set to 127, so that old
  63.                trackers will search through all patterns when loading.
  64.                Noisetracker uses this byte for restart, but we don't.
  65.  952    128    Song positions 0-127. Each hold a number from 0-63 that
  66.                tells the tracker what pattern to play at that position.
  67. 1080      4    The four letters "M.K." - This is something Mahoney & Kaktus
  68.                inserted when they increased the number of samples from
  69.                15 to 31. If it's not there, the module/song uses 15 samples
  70.                or the text has been removed to make the module harder to
  71.                rip. Startrekker puts "FLT4" or "FLT8" there instead.
  72.  
  73. Offset  Bytes  Description
  74. ------  -----  -----------
  75. 1084    1024   Data for pattern 00.
  76.    .
  77.    .
  78.    .
  79. xxxx  Number of patterns stored is equal to the highest patternnumber
  80.       in the song position table (at offset 952-1079).
  81.  
  82. Each note is stored as 4 bytes, and all four notes at each position in
  83. the pattern are stored after each other.
  84.  
  85. 00 -  chan1  chan2  chan3  chan4
  86. 01 -  chan1  chan2  chan3  chan4
  87. 02 -  chan1  chan2  chan3  chan4
  88. etc.
  89.  
  90. Info for each note:
  91.  
  92.  _____byte 1_____   byte2_    _____byte 3_____   byte4_
  93. /                \ /      \  /                \ /      \
  94. 0000          0000-00000000  0000          0000-00000000
  95.  
  96. Upper four    12 bits for    Lower four    Effect command.
  97. bits of sam-  note period.   bits of sam-
  98. ple number.                  ple number.
  99.  
  100. Periodtable for Tuning 0, Normal
  101.   C-1 to B-1 : 856,808,762,720,678,640,604,570,538,508,480,453
  102.   C-2 to B-2 : 428,404,381,360,339,320,302,285,269,254,240,226
  103.   C-3 to B-3 : 214,202,190,180,170,160,151,143,135,127,120,113
  104.  
  105. To determine what note to show, scan through the table until you find
  106. the same period as the one stored in byte 1-2. Use the index to look
  107. up in a notenames table.
  108.  
  109. This is the data stored in a normal song. A packed song starts with the
  110. four letters "PACK", but i don't know how the song is packed: You can
  111. get the source code for the cruncher/decruncher from us if you need it,
  112. but I don't understand it; I've just ripped it from another tracker...
  113.  
  114. In a module, all the samples are stored right after the patterndata.
  115. To determine where a sample starts and stops, you use the sampleinfo
  116. structures in the beginning of the file (from offset 20). Take a look
  117. at the mt_init routine in the playroutine, and you'll see just how it
  118. is done.
  119.  
  120. Lars "ZAP" Hamre/Amiga Freelancers
  121.  
  122.